<template>
  <div class="common-divider">
    <div class="common-divider__wrapped">
      <div class="common-divider__left">
        <div class="common-divider__line to-right" />
        <div class="common-divider__dot" />
      </div>
      <div class="common-divider__label">
        <slot>
          {{ label }}
        </slot>
        <div class="common-divider__sub">{{ sub }}</div>
      </div>
      <div class="common-divider__right">
        <div class="common-divider__dot" />
        <div class="common-divider__line to-left" />
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
defineOptions({
  name: "common-divider",
});

withDefaults(
  defineProps<{
    label: string;
    sub?: string;
  }>(),
  {
    label: "",
    sub: "",
  }
);
</script>

<style lang="less">
.common-divider {
  width: 100%;
  display: flex;
  flex-direction: column;
  padding: 28px 0;
  gap: 12px;
  &__wrapped {
    display: flex;
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
  }
  &__sub {
    width: 100%;
    text-align: center;
    font-weight: 400;
    font-size: 20px;
    color: #8b8b8b;
    line-height: 26px;
  }

  &__label {
    font-weight: 400;
    font-size: 24px;
    color: #8b8b8b;
    line-height: 26px;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  &__left,
  &__right {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  &__dot {
    width: 8px;
    height: 8px;
    background: #8b8b8b;
    transform: rotate(-45deg);
  }
  &__line {
    flex: 1;
    height: 2px;
    &.to-right {
      background: linear-gradient(
        to right,
        rgba(200, 200, 200, 0),
        rgba(151, 151, 151, 1)
      );
    }
    &.to-left {
      background: linear-gradient(
        to left,
        rgba(200, 200, 200, 0),
        rgba(151, 151, 151, 1)
      );
    }
  }
}
</style>
